from django.conf.urls import url
from rest_framework import routers
from rest_framework_jwt.views import obtain_jwt_token
from .views import statistical,user,specs,image,skus,spus,brands,channels,options,orders,permisson,groups,admin

urlpatterns = [
    url(r'^authorizations/$', obtain_jwt_token),
    url(r'^statistical/total_count/$', statistical.UserToalCountView.as_view()),
    url(r'^statistical/day_increment/$', statistical.UserDayCountView.as_view()),
    url(r'^statistical/day_active/$', statistical.UserActiveCountView.as_view()),
    url(r'^statistical/day_orders/$', statistical.UserOderCountView.as_view()),
    url(r'^statistical/month_increment/$', statistical.UserMonthCountView.as_view()),
    url(r'^statistical/goods_day_views/$', statistical.GoodsDayView.as_view()),
    # 用户管理路由
    url(r'^users/$', user.UserView.as_view()),
    # 规格管理路由
    url(r'^goods/simple/$', specs.SpecsView.as_view({'get':'simple'})),
    # 图片路由管理
    url(r'^skus/simple/$', image.SKUImagesView.as_view({'get':'simple'})),
    # sku管理路由
    url(r'^goods/(?P<pk>\d+)/specs/$', skus.SKUView.as_view({'get':'specs'})),
    # 商品spu管理路由
    url(r'^goods/images/$', spus.SPUView.as_view({'post':'images'})),
    url(r'^goods/brands/simple/$', spus.SPUView.as_view({'get':'simple'})),
    url(r'^goods/channel/categories/$', spus.SPUView.as_view({'get':'categories'})),
    url(r'^goods/channel/categories/(?P<pk>\d+)/$', spus.SPUView.as_view({'get':'category_subs'})),
    # 频道channel管理路由
    url(r'^goods/channel_types/$', channels.ChannelsView.as_view({'get':'channel_types'})),
    url(r'^goods/categories/$', channels.ChannelsView.as_view({'get':'categories'})),
    # 规格选项channel管理路由
    url(r'^goods/specs/simple/$', options.OtionsView.as_view({'get':'simple'})),
    # 权限permission管理路由
    url(r'^permission/content_types/$', permisson.PermissionView.as_view({'get':'content_types'})),
    # 组group管理路由
    url(r'^permission/simple/$', groups.GroupView.as_view({'get':'simple'})),
    # 管理员admin管理路由
    url(r'^permission/groups/simple/$', admin.adminView.as_view({'get':'simple'})),




]
# 管理员admin管理路由
router = routers.DefaultRouter()
router.register(r'permission/admins',admin.adminView,basename='admin')
urlpatterns += router.urls


# 规格选项option管理路由
# router = routers.DefaultRouter()
router.register(r'specs/options',options.OtionsView,basename='option')
urlpatterns += router.urls

# 频道channel管理路由
router.register(r'goods/channels',channels.ChannelsView,basename='channel')
urlpatterns += router.urls

# 品牌brand管理路由
router.register(r'goods/brands',brands.BrandsView,basename='brand')
urlpatterns += router.urls


# 规格管理路由
router.register(r'goods/specs',specs.SpecsView,basename='specs')
urlpatterns += router.urls

# 商品图片管理路由
router.register(r'skus/images',image.SKUImagesView,basename='image')
urlpatterns += router.urls

# 商品sku管理路由
router.register(r'skus',skus.SKUView,basename='sku')
urlpatterns += router.urls

# 商品spu管理路由
router.register(r'goods',spus.SPUView,basename='spu')
urlpatterns += router.urls


# 订单order管理路由
router.register(r'orders',orders.OrderInfoView,basename='option')
urlpatterns += router.urls

# 权限permission管理路由
router.register(r'permission/perms',permisson.PermissionView,basename='permission')
urlpatterns += router.urls

# 组group管理路由
router.register(r'permission/groups',groups.GroupView,basename='group')
urlpatterns += router.urls





